// Fill out your copyright notice in the Description page of Project Settings.


#include "SoulGameplay/SoulKnightPlayerController.h"

#include "Blueprint/UserWidget.h"
#include "Components/TextBlock.h"
#include "UI/MainHUD.h"
#include "UI/MainUI.h"

ASoulKnightPlayerController::ASoulKnightPlayerController()
{
}

void ASoulKnightPlayerController::BeginPlay()
{
	Super::BeginPlay();
	MainHUD = Cast<AMainHUD>(GetHUD());
	if (HasAuthority())
	{
		Init();
	}
	else
	{
		ClientInit();
	}
}

void ASoulKnightPlayerController::Init()
{
	MainHUD = MainHUD == nullptr ? Cast<AMainHUD>(GetHUD()) : MainHUD;
	if (MainHUD)
	{
		MainHUD->InitializeWidgets();
	}
}

void ASoulKnightPlayerController::ClientInit_Implementation()
{
	Init();
}

